// ignore_for_file: must_be_immutable

part of 'player_profile_bloc.dart';

/// Represents the state of Profile in the application.
class ProfileState extends Equatable {
  ProfileState({this.user, this.isLoading = true , this.isError = false , this.error=''});

  User? user;

  bool isLoading;
  bool isError;
  String error;



  @override
  List<Object?> get props => [user, isLoading];

  ProfileState copyWith({User? user, bool? isLoading, bool? isError, String? error}) {
    return ProfileState(
      user: user ?? this.user,
      isLoading: isLoading ?? this.isLoading,
      isError: isError?? this.isError,
      error: error?? this.error,
    );
  }

  ProfileState hasError({String? error}) {
    return ProfileState(
      user: null,
      isLoading: false,
      error: error??"حدث خطأ ما الرجاء اعادة المحاولة لاحقاً",
      isError: true,
    );
  }

  ProfileState hasLoading() {
    return ProfileState(
      user: null,
      isLoading: true,
      error: '',
      isError: false,
    );
  }
  ProfileState gotData({required User user}) {
    return ProfileState(
      user: user,
      isLoading: false,
      error: '',
      isError: false,
    );
  }

}
